home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 21.zip / BS1 part 21 / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].7z / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].adf / rexx.lzh / GroupSpace.pprx < prev    next >
Text File  |  1992-03-13  |  3KB  |  153 lines

  1. /*
  2. @BGroupSpace  @P@ICopyright Gold Disk Inc., February, 1992
  3.  
  4. This Genie will reposition all the boxes in the current group. Boxes will be spaced out by a user-specified distance. Distance can be set between left, right, top, or bottom edges, box centers, or boxes.
  5.  
  6. */
  7. cr = '0a'x
  8. address command
  9. call SafeEndEdit.rexx()
  10. call ppm_AutoUpdate(0)
  11.  
  12. units = ppm_GetUnits()
  13. if units = 3 then
  14.     call ppm_SetUnits(1)
  15.  
  16. signal on halt
  17. signal on break_c
  18. signal on break_e
  19. signal on break_d
  20.  
  21. group = ppm_GroupFirstBox()
  22. if group = 0 then exit_msg("Please select a group first")
  23.  
  24. hspacing = "Left"cr"Right"cr"Centers"cr"Boxes"cr"None"
  25. vspacing = "Top"cr"Bottom"cr"Centers"cr"Boxes"cr"None"
  26.  
  27. hspacing = ppm_SelectFromList("Horizontal Spacing..", 15, 5, 0, hspacing)
  28. if hspacing = '' then exit_msg()
  29.  
  30. vspacing = ppm_SelectFromList("Vertical Spacing..", 15, 5, 0, vspacing)
  31. if vspacing = '' then exit_msg()
  32.  
  33. vdist = 0
  34. hdist = 0
  35.  
  36. if hspacing ~= "None" then
  37. do
  38.     string = hspacing
  39.     if hspacing="Left" | hspacing="Right" then
  40.     do
  41.     string = hspacing" edges"
  42.     end
  43.  
  44.     hdist = ppm_GetForm( "Enter Horizontal Spacing", 8, "Between "string)
  45.     if hdist = '' then exit_msg()
  46.  
  47.     if ~datatype(hdist, n) then
  48.         call exit_msg('Invalid Input')
  49.  
  50.     if units = 3 then
  51.         hdist = ppm_ConvertUnits(3, 1, hdist)
  52. end
  53.  
  54. if vspacing ~= "None" then
  55. do
  56.     string = vspacing
  57.     if vspacing="Top" | vspacing="Bottom" then
  58.     do
  59.     string = vspacing" edges"
  60.     end
  61.  
  62.     vdist = ppm_GetForm( "Enter Vertical Spacing", 8, "Between "string)
  63.     if vdist = '' then exit_msg()
  64.  
  65.     if ~datatype(vdist, n) then
  66.         call exit_msg('Invalid Input')
  67.  
  68.     if units = 3 then
  69.         vdist = ppm_ConvertUnits(3, 1, vdist)
  70. end
  71.  
  72. grouprect    = ppm_GetGroupRect()
  73. groupleft    = word(grouprect, 1)
  74. grouptop    = word(grouprect, 2)
  75.  
  76. hspace    = "hpos = hpos + hdist"
  77. vspace    = "vpos = vpos + vdist"
  78. vpos    = grouptop
  79. hpos    = groupleft
  80.  
  81. if vspacing = "Top" then
  82.     vstring = "vpos"
  83. else if vspacing = "Bottom" then
  84.     vstring = "vpos - height"
  85. else if vspacing = "Centers" then
  86.     vstring = "vpos - .5 * height"
  87. else if vspacing = "Boxes" then
  88. do
  89.     vstring = "vpos"
  90.     vspace    = "vpos = vpos + height + vdist"
  91. end
  92. else
  93. do
  94.     vstring = "top"
  95.     vspace    = "/**/"
  96. end
  97.  
  98. if hspacing = "Left" then
  99.     hstring = "hpos"
  100. else if hspacing = "Right" then
  101.     hstring = "hpos - width"
  102. else if hspacing = "Centers" then
  103.     hstring = "hpos - .5 * width"
  104. else if hspacing = "Boxes" then
  105. do
  106.     hstring = "hpos"
  107.     hspace    = "hpos = hpos + width + hdist"
  108. end
  109. else
  110. do
  111.     hstring = "left"
  112.     hspace    = "/**/"
  113. end
  114.  
  115. box = ppm_GroupFirstBox()
  116.  
  117. do while box ~= 0
  118.  
  119.     boxpos  = ppm_GetBoxRect(box)
  120.     left    = word(boxpos, 1)
  121.     top        = word(boxpos, 2)
  122.     width    = word(boxpos, 3)
  123.     height    = word(boxpos, 4)
  124.  
  125.     interpret "x = "hstring
  126.     interpret "y = "vstring
  127.     call ppm_SetBoxPosition(box, x, y)
  128.     interpret hspace
  129.     interpret vspace
  130.  
  131.     box = ppm_GroupNextBox(box)
  132.  
  133. end
  134. call exit_msg()
  135. break_d:
  136. break_e:
  137. break_c:
  138. halt:
  139.     call exit_msg("User aborted Genie!")
  140.  
  141. exit_msg: procedure expose units
  142. do
  143.     parse arg message
  144.  
  145.     if message ~= '' then
  146.     call ppm_Inform( 1, message, )
  147.  
  148.     if units = 3 then call ppm_SetUnits(3)
  149.     call ppm_AutoUpdate(1)
  150.     exit
  151.  
  152. end